<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" th:fragment="footer">
<!-- 网站底部：包含社交链接、版权信息等 -->
<body>
<footer class="footer bg-white">
    <!-- 社交链接区域 -->
    <div class="footer-social">
        <div class="footer-container clearfix">
            <div class="social-list">
                <!-- 循环遍历社交账号 -->
                <th:block th:each="index:${commons.social()}">
                    <th:block th:if="${index.value}!=null and ${index.value}!=''">
                        <!-- 根据社交平台类型显示不同链接 -->
                        <th:block th:switch="${index.key}">
                            <th:block th:case="'weibo'">
                                <a class="social weibo" target="blank"
                                   th:href="@{${index.value}}">微博</a>
                            </th:block>
                            <th:block th:case="'zhihu'">
                                <a class="social zhihu" target="blank"
                                   th:href="@{${index.value}}">知乎</a>
                            </th:block>
                            <th:block th:case="'github'">
                                <a class="social github" target="blank"
                                   th:href="@{${index.value}}">Github</a>
                            </th:block>
                            <th:block th:case="'twitter'">
                                <a class="social twitter" target="blank"
                                   th:href="@{${index.value}}">Twitter</a>
                            </th:block>
                        </th:block>
                    </th:block>
                </th:block>
            </div>
        </div>
    </div>
    <!-- 版权信息区域 -->
    <div class="footer-meta">
        <div class="footer-container">
            <div class="meta-item meta-copyright">
                <div class="meta-copyright-info">
                    <div class="info-text">
                        <!-- 网站Logo -->
                        <a href="http://www.54tianzhisheng.cn" target="_blank" style="display: block;margin: 0 auto;" class="info-logo">
                            <img style="display: block;margin: 0 auto;" th:src="@{/user/img/logo.png}" th:alt="${commons.site_title()}"/>
                        </a>
                        <br/>
                        <!-- 版权声明 -->
                        <p>&copy; 版权所有 <a href="https://github.com/zhisheng17/blog" target="_blank"
                                              rel="nofollow">My Blog</a> 保留一切权利
                        </p>
                        <br/>
                        <!-- 备案信息 -->
                        <p>赣ICP备16004176号</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</footer>

<!-- 文章页面目录功能 -->
<th:block th:if="${is_post}">
    <div id="directory-content" class="directory-content">
        <div id="directory"></div>
    </div>
    <script>
        /* 生成文章目录的函数 */
        var postDirectoryBuild = function () {
        };
        postDirectoryBuild();
    </script>
</th:block>

<!-- 引入第三方库和自定义脚本 -->
<script th:src="@{//cdn.bootcss.com/headroom/0.9.1/headroom.min.js}"></script>
<script th:src="@{//cdn.bootcss.com/highlight.js/9.9.0/highlight.min.js}"></script>
<script th:src="@{//cdn.bootcss.com/instantclick/3.0.1/instantclick.min.js}"></script>
<script th:inline="javascript">

    /* 头部导航栏和搜索功能初始化 */
    var isOk = [[${is_post}]];
    if (isOk) {
        /* 文章目录初始化 */
        var postDirectory = new Headroom(document.getElementById("directory-content"), {
            tolerance: 0,
            offset: 100,
            classes: {
                initial: "initial",
                pinned: "pinned",
                unpinned: "unpinned"
            }
        });
    }

    /* 头部导航栏初始化 */
    var header = new Headroom(document.getElementById("header"), {
        tolerance: 10,
        offset: 80,
        classes: {
            initial: "animated",
            pinned: "slideDown",
            unpinned: "slideUp"
        }
    });
    header.init();

    /* 搜索框回车事件 */
    $('#search-inp').keypress(function (e) {
        var key = e.which;
        if (key == 13) {
            var q = $(this).val();
            if (q && q != '') {
                window.location.href = '/search/' + q;
            }
        }
    });
</script>
<script data-no-instant="">
    /* InstantClick 页面预加载和高亮代码初始化 */
    InstantClick.on('change', function (isInitialLoad) {
        var blocks = document.querySelectorAll('pre code');
        for (var i = 0; i < blocks.length; i++) {
            hljs.highlightBlock(blocks[i]);
        }
        if (isInitialLoad === false) {
            if (typeof ga !== 'undefined') ga('send', 'pageview', location.pathname + location.search);
        }
    });
    InstantClick.init('mousedown');

</script>
</body>
</html>